package com.meterreadingsys.activity;

import com.meterreadingsys.util.SharedPreferenceUtil;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SettingActivity extends Activity {

	public EditText ip;

	public EditText port;

	public Button button;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.setting);
		ip = (EditText) findViewById(R.id.ip);
		port = (EditText) findViewById(R.id.port);
		String[] s=SharedPreferenceUtil.queryWeb(SettingActivity.this);
		System.out.println(s.length);
		ip.setText(s[0]);
		port.setText(s[1]);
		button = (Button) findViewById(R.id.setting);

		button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				boolean b = SharedPreferenceUtil.insertIP(SettingActivity.this,
						ip.getText().toString(), port.getText().toString());
				if (b) {
					System.out.println("修改成功");
				} else {
					System.out.println("修改失败");
				}

			}
		});

	}

}
